package com.patterns.demo.prototype;

import java.io.IOException;

/**
 * Author: SamGroves
 * <p>
 * Description:
 * <p>
 * Date: 2017/11/29
 */
public class Test {

    public static void main(String[] args) throws IOException, ClassNotFoundException, CloneNotSupportedException {

        ConcretePrototype concretePrototype = new ConcretePrototype();

        for (int i = 1; i <= 5; i ++) {
            System.out.println("浅复制" + i);
            ConcretePrototype cloneConcretePrototype = (ConcretePrototype) concretePrototype.lightClone();
            cloneConcretePrototype.show();
        }

        for (int i = 1; i <= 5; i ++) {
            System.out.println("深复制" + i);
            ConcretePrototype cloneConcretePrototype = (ConcretePrototype) concretePrototype.deepClone();
            cloneConcretePrototype.show();
        }
    }
}
